import { Entity, Column, Index } from 'typeorm';
import { BaseEntity } from '../../base/entity/base';

/**
 * 用户联系人信息
 */
@Entity({ name: 'user_contact' })
export class UserContactEntity extends BaseEntity {
  @Index()
  @Column({ comment: 'Oracle业务ID', length: 50 })
  erpBusinessId: string;

  @Index()
  @Column({ comment: '联系人ID (来自Oracle)', length: 50, nullable: true })
  contactId: string; // CONTACTID

  @Column({ comment: '联系人姓名', length: 100, nullable: true })
  contact: string; // CONTACT

  @Column({ comment: '身份证号', length: 50, nullable: true })
  idCard: string; // IDCARD

  @Column({ comment: '联系电话', length: 50, nullable: true })
  phone: string; // TELEPHONE AS PHONE

  @Column({ type: 'datetime', comment: '委托书日期', nullable: true })
  consCertDate: Date; // CONSCERTDATE

  @Column({ type: 'datetime', comment: '委托书有效期', nullable: true })
  consMandate: Date; // CONSMANDATE

  @Column({ comment: '经营范围', type: 'text', nullable: true })
  businessCont: string; // CONSCOPE | | '消毒用品,一类器械,非药品'

  // 建议添加唯一约束，例如 erpBusinessId 和 contactId 组合
  // @Index(['erpBusinessId', 'contactId'], { unique: true })
} 